package org.example.dto;

/**
 * @Classname StringReverse
 * @Description TODO
 * @Date 2021/4/12 4:03 下午
 * @Created by xiangjd
 */
public class StringReverse {

    public static void main(String[] args) {
        StringReverse stringReverse = new StringReverse();
        String str = "abcdefg";
        System.out.println(stringReverse.getReverse(str));

    }


    public String getReverse(String str) {
        if (str == null || str.length() <= 1) {
            return str;
        }

        return getReverse(str.substring(1)) + str.charAt(0);
    }
}
